//
//  XReviewTwoTableViewCell.m
//  Bees
//
//  Created by Xiaohan on 2018/12/21.
//  Copyright © 2018 xiaohan. All rights reserved.
//

#import "XReviewTwoTableViewCell.h"
#import "InformationModel.h"
@implementation XReviewTwoTableViewCell
- (void)setModel:(EvaluationModel *)model{
    _model = model;
    [self.contentImgView sd_setImageWithURL:String_To_URL(model.cover)];
    self.nameLab.text = [NSString stringWithFormat:@"%@:%@",XLocalized(@"作者"),model.author];
    self.titleLab.text = model.title;
}
- (void)setupUI{
    self.backView = [[UIView alloc]initWithFrame:CGRectZero];;
    [self.contentView addSubview:self.backView];
    [self.backView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.mas_equalTo(kNormalSpace);
        make.left.mas_equalTo(kNormalSpace);
        make.right.mas_equalTo(-kNormalSpace);
        make.bottom.mas_equalTo(-kNormalSpace);
    }];
    self.backView.backgroundColor = UIColor.whiteColor;
    self.backView.layer.cornerRadius = AdaptedWidth(10.0f);
    [self.backView setLayerShadow:kShadowColor offset:CGSizeMake(0, 0) radius:6];
    self.contentImgView = [UIImageView new];
    ViewRadius(self.contentImgView, AdaptedWidth(10.0f));
    [self.backView addSubview:self.contentImgView];
    [self.contentImgView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.mas_equalTo(AdaptedWidth(12));
        make.right.mas_equalTo(-AdaptedWidth(9));
        make.height.mas_equalTo(AdaptedWidth(70));
        make.width.mas_equalTo(AdaptedWidth(100));
    }];
    self.titleLab = [UILabel new];
    self.titleLab.font = kBoldFont(15);
    self.titleLab.numberOfLines = 0;
    self.titleLab.textColor = UIColorHex(333333);
    [self.backView addSubview:self.titleLab];
    [self.titleLab mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(self.contentImgView.mas_top);
        make.left.mas_equalTo(AdaptedWidth(15));
        make.right.mas_equalTo(self.contentImgView.mas_left).offset(-AdaptedWidth(13));
    }];
    
    self.nameLab = [UILabel new];
    self.nameLab.font = kDefaultFont(12);
    self.nameLab.textColor = kColorTextGray;
    [self.backView addSubview:self.nameLab];
    [self.nameLab mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(self.titleLab.mas_bottom).offset(AdaptedWidth(28));
        make.left.equalTo(self.titleLab.mas_left);
        make.bottom.mas_equalTo(-kNormalSpace);
    }];
}
@end
@implementation XReviewBigTableViewCell
- (void)setModel:(EvaluationModel *)model{
    _model = model;
    [self.contentImgView sd_setImageWithURL:String_To_URL(model.big_cover)];
    self.nameLab.text = [NSString stringWithFormat:@"%@:%@",XLocalized(@"作者"),model.author];
    self.titleLab.text = model.title;
}
- (void)setupUI{
    self.backView = [[UIView alloc]initWithFrame:CGRectZero];;
    [self.contentView addSubview:self.backView];
    [self.backView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.mas_equalTo(kNormalSpace);
        make.left.mas_equalTo(kNormalSpace);
        make.right.mas_equalTo(-kNormalSpace);
        make.bottom.mas_equalTo(-kNormalSpace);
    }];
    self.backView.backgroundColor = UIColor.whiteColor;
    self.backView.layer.cornerRadius = AdaptedWidth(10.0f);
    [self.backView setLayerShadow:kShadowColor offset:CGSizeMake(0, 0) radius:6];
    self.contentImgView = [UIImageView new];
    ViewRadius(self.contentImgView, AdaptedWidth(10.0f));
    [self.backView addSubview:self.contentImgView];
    [self.contentImgView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.right.top.mas_equalTo(AdaptedWidth(0));
        make.height.mas_equalTo(AdaptedWidth(126));
    }];
    self.titleLab = [UILabel new];
    self.titleLab.font = kBoldFont(15);
    self.titleLab.numberOfLines = 0;
    self.titleLab.textColor = UIColorHex(333333);
    [self.backView addSubview:self.titleLab];
    [self.titleLab mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(self.contentImgView.mas_bottom).offset(AdaptedWidth(10));
        make.left.mas_equalTo(AdaptedWidth(15));
        make.right.mas_equalTo(-AdaptedWidth(15));
    }];
    
    self.nameLab = [UILabel new];
    self.nameLab.font = kDefaultFont(12);
    self.nameLab.textColor = kColorTextGray;
    [self.backView addSubview:self.nameLab];
    [self.nameLab mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(self.titleLab.mas_bottom).offset(AdaptedWidth(18));
        make.left.equalTo(self.titleLab.mas_left);
        make.right.mas_equalTo(-AdaptedWidth(15));
        make.bottom.mas_equalTo(-AdaptedWidth(15));
    }];
}
@end
